//
//  CaseWashCollectionViewCell.m
//  WashForU
//
//  Created by 王俊 on 15/11/26.
//  Copyright © 2015年 王俊. All rights reserved.
//

#import "CaseWashCollectionViewCell.h"

@implementation CaseWashCollectionViewCell


-(void)setUpViewWith:(ClothesInfo *) info
{
    _showImage = [[UIImageView alloc]init];
    _lineImage = [[UIImageView alloc]init];
    _priceLabel = [[UILabel alloc]init];
    _titleLabel = [[UILabel alloc]init];
    _showImage.image = [UIImage imageNamed:info.imageName];
    _priceLabel.text = [NSString stringWithFormat:@"￥%d",info.price];
    _titleLabel.text = info.title;
    self.backgroundColor = [UIColor whiteColor];
    
    _lineImage.image = [UIImage imageNamed:@"白底黑线"];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _priceLabel.textAlignment = NSTextAlignmentCenter;
    _priceLabel.textColor = [UIColor redColor];
    _titleLabel.font = [UIFont CustomFont:15];
    _titleLabel.textColor = [UIColor GrayColor_88];
    
    [self addSubview:_showImage];
    [self addSubview:_lineImage];
    [self addSubview:_priceLabel];
    [self addSubview:_titleLabel];
    
    [_showImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(15);
        make.leading.equalTo(self).offset(30);
        make.trailing.equalTo(self).offset(-30);
        make.height.equalTo(_showImage.mas_width).multipliedBy(21.0/19.0);
    }];
    [_lineImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_showImage.mas_bottom).offset(5);
        make.leading.equalTo(self).offset(15);
        make.trailing.equalTo(self).offset(-15);
        make.height.mas_equalTo(5);
    }];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(80, 20));
        make.top.equalTo(_lineImage.mas_bottom).offset(2);
        make.centerX.equalTo(_showImage);
    }];
    [_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.centerX.equalTo(_titleLabel);
        make.top.equalTo(_titleLabel.mas_bottom).offset(2);
    }];
}

@end


